package CONEXAO;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;

public class Conexao {
    
    public static Connection conectar(String nomeDoBanco) throws SQLException{
        try {
            Class.forName("com.mysql.jdbc.Driver");
            String url = "jdbc:mysql://localhost/" + nomeDoBanco;
            return DriverManager.getConnection(url, "root", "root");
        } catch (ClassNotFoundException e) {
            System.err.println("Erro: "+e.toString());
            return null;
        }
    }
}